Skip to content

Refactor mcp tools to use FastMCP composition#25

Merged
RadCod3 merged 4 commits into
mainfrom
feat/15-mcp-composition
Jan 8, 2026
Merged

Refactor mcp tools to use FastMCP composition#25
RadCod3 merged 4 commits into
mainfrom
feat/15-mcp-composition

Conversation

@RadCod3
Copy link
Copy Markdown
Owner

@RadCod3 RadCod3 commented Jan 8, 2026

Resolves #15

Copilot AI review requested due to automatic review settings January 8, 2026 14:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the MCP tools architecture from direct tool registration to a composition-based approach using FastMCP's import_server() method. The goal is to create standalone servers for each domain (accounts, transactions, budgets) and compose them into the main server.

Key Changes:

  • Replaced register_tools() functions with create_*_server() functions that return FastMCP instances
  • Introduced compose_all_servers() async function to import domain servers into the main server
  • Modified server initialization to call composition logic during module initialization

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/lampyrid/tools/transactions.py Refactored from register_tools() to create_transactions_server() that returns a standalone FastMCP server
src/lampyrid/tools/budgets.py Refactored from register_tools() to create_budgets_server() that returns a standalone FastMCP server
src/lampyrid/tools/accounts.py Refactored from register_tools() to create_accounts_server() that returns a standalone FastMCP server
src/lampyrid/tools/init.py Changed from register_all_tools() to async compose_all_servers() using import_server()
src/lampyrid/server.py Added _initialize_server() function and uses asyncio.run() to compose servers during module initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lampyrid/server.py
Comment thread src/lampyrid/server.py
@RadCod3 RadCod3 merged commit 2d5ce81 into main Jan 8, 2026
3 checks passed
@RadCod3 RadCod3 deleted the feat/15-mcp-composition branch January 10, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restructure code for clarity: Split MCP tools from single server.py file

2 participants